<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3"/>
<title>Duye SDK User Wizard: Z:/duye/src/duyebase/system/duye_sys.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Duye SDK User Wizard
   &#160;<span id="projectnumber">V1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_331246d48b7bdbf84ac81996db21b8ff.html">duyebase</a></li><li class="navelem"><a class="el" href="dir_b5c4da77347288fd09626ce6d1e5fb84.html">system</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">duye_sys.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="duye__sys_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/************************************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">**  </span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">* @copyright (c) 2013-2100, ChengDu Duyer Technology Co., LTD. All Right Reserved.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">*</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">*************************************************************************************/</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;malloc.h&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &lt;string.h&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="duye__type_8h.html">duye_type.h</a>&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#define ERROR_DUYE_LOG(args...) System::pformat((char*)m_error.errorLog, m_error.errorBufSize, ##args);</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ERROR_DUYE_LOGE(err, args...) System::pformat((char*)err.errorLog, err.errorBufSize, ##args);</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="keyword">namespace </span>duye {</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="code" href="classduye_1_1_error.html">   31</a></span>&#160;<span class="keyword">class </span><a class="code" href="classduye_1_1_error.html">Error</a> {</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <a class="code" href="classduye_1_1_error.html">Error</a>() : errorLog(NULL), errorBufSize(0) {</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;        uint32 size = snprintf((<span class="keywordtype">char</span>*)error, <a class="code" href="duye__type_8h.html#a251d0c060c635abfad706e8df0e0ebc1" title="limits number for error info buffer size">ERROR_BUF_SIZE</a>, <span class="stringliteral">&quot;\033[1;31;40m[error]\033[0m&quot;</span>);    </div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;        error[size] = 0;</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;        errorBufSize = <a class="code" href="duye__type_8h.html#a251d0c060c635abfad706e8df0e0ebc1" title="limits number for error info buffer size">ERROR_BUF_SIZE</a> - size - 1;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;        errorLog = error + size;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    }</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    ~<a class="code" href="classduye_1_1_error.html">Error</a>() {}</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keywordtype">void</span> setPrefix(<span class="keyword">const</span> int8* prefix) {</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;        <span class="keywordflow">if</span> (prefix == NULL) <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;        </div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        uint32 size = snprintf((<span class="keywordtype">char</span>*)error, <a class="code" href="duye__type_8h.html#a251d0c060c635abfad706e8df0e0ebc1" title="limits number for error info buffer size">ERROR_BUF_SIZE</a>, <span class="stringliteral">&quot;\033[1;31;40m[error]\033[0m&lt;%s&gt;&quot;</span>, prefix);        </div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        error[size] = 0;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        errorBufSize = <a class="code" href="duye__type_8h.html#a251d0c060c635abfad706e8df0e0ebc1" title="limits number for error info buffer size">ERROR_BUF_SIZE</a> - size - 1;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        errorLog = error + size;</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    }</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    uint8   error[<a class="code" href="duye__type_8h.html#a251d0c060c635abfad706e8df0e0ebc1" title="limits number for error info buffer size">ERROR_BUF_SIZE</a>];</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    uint8*  errorLog;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    uint32  errorBufSize;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;};</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="code" href="classduye_1_1_system.html">   56</a></span>&#160;<span class="keyword">class </span><a class="code" href="classduye_1_1_system.html">System</a> {</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classduye_1_1_system.html#a34a0c177baf9520260cf855b2efca320" title="sleep">sleep</a>(<span class="keyword">const</span> uint64&amp; time);</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classduye_1_1_system.html#a56336951deb64c0dd577fdc301fd569a" title="usleep">msleep</a>(<span class="keyword">const</span> uint64&amp; time);    </div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    </div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classduye_1_1_system.html#ae86ab2172d0e2ac3320ac576f4424b6d" title="usleep">usleep</a>(<span class="keyword">const</span> uint64&amp; time);</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    </div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    <span class="keyword">static</span> int64 <a class="code" href="classduye_1_1_system.html#ae84745d111fd169d7d6befe9143d8062" title="format">pformat</a>(int8* buffer, <span class="keyword">const</span> uint64 size, <span class="keyword">const</span> int8* args, ...);   </div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    </div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="keyword">static</span> int32 <a class="code" href="classduye_1_1_system.html#ade33f02d88f61f508301d265d6690c54" title="execute shell command">shell</a>(<span class="keyword">const</span> int8* cmd, int8* result , <span class="keyword">const</span> uint32 result_size);</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    </div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <span class="keyword">static</span> int32 <a class="code" href="classduye_1_1_system.html#ade33f02d88f61f508301d265d6690c54" title="execute shell command">shell</a>(<span class="keyword">const</span> int8* cmd, ...);</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keyword">static</span> int32 <a class="code" href="classduye_1_1_system.html#ade33f02d88f61f508301d265d6690c54" title="execute shell command">shell</a>(<span class="keyword">const</span> uint32 cmd_len, <span class="keyword">const</span> int8* cmd, ...);</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    <span class="keyword">static</span> int32 <a class="code" href="classduye_1_1_system.html#ade33f02d88f61f508301d265d6690c54" title="execute shell command">shell</a>(std::string&amp; result, <span class="keyword">const</span> int8* cmd, ...);</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="keyword">static</span> int32 <a class="code" href="classduye_1_1_system.html#ade33f02d88f61f508301d265d6690c54" title="execute shell command">shell</a>(<span class="keyword">const</span> uint32 cmd_len, std::string&amp; result, <span class="keyword">const</span> int8* cmd, ...);</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="keyword">static</span> int32 <a class="code" href="classduye_1_1_system.html#ade33f02d88f61f508301d265d6690c54" title="execute shell command">shell</a>(<span class="keyword">const</span> uint32 cmd_len, int8* result, <span class="keyword">const</span> uint32 result_size, <span class="keyword">const</span> int8* cmd, ...);</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    </div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="keyword">static</span> uint64 <a class="code" href="classduye_1_1_system.html#a5cfffdc8f55b93cd90dcea184f4fa73c" title="get system time">sysTime</a>();</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    </div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classduye_1_1_system.html#a9c3cea2a5f53d80af2d5be0d96634e1e" title="get options">optArg</a>(int32 argc, int8** argv, int8* cmd, int64&amp; value);</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classduye_1_1_system.html#a9c3cea2a5f53d80af2d5be0d96634e1e" title="get options">optArg</a>(int32 argc, int8** argv, int8* cmd, uint64&amp; value);</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classduye_1_1_system.html#a9c3cea2a5f53d80af2d5be0d96634e1e" title="get options">optArg</a>(int32 argc, int8** argv, int8* cmd, std::string&amp; value);</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classduye_1_1_system.html#a2bf2b10079ceb4a379f08d4ca69b1dac" title="create daemon process">daemonize</a>();</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classduye_1_1_system.html#ad951d255082cdd895661295fe5fe485b" title="limit process CPU resource usage">limitCpu</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* process_name, <span class="keyword">const</span> uint16 cpu_percent);</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    </div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classduye_1_1_system.html#acdcfcee85cd31b4a304f5a4b0f4a942d" title="get ip address by physical network card name">getIPAddrByDevName</a>(<span class="keyword">const</span> std::string&amp; phyCardName, std::string&amp; ipAddr);</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classduye_1_1_system.html#a824e5cb2140bfacab490ca4ce6f507d9" title="get first valid ip address">getFirstValidIPAddr</a>(std::string&amp; ipAddr);</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classduye_1_1_system.html#ad0e93f80d358761e4d27665f4a919012" title="get first valid ip address">getNetworkCards</a>(std::map&lt;std::string, std::string&gt;&amp; networkCards);</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    <span class="keyword">static</span> uint32 <a class="code" href="classduye_1_1_system.html#ac54f9077e03b9de605e0ab8262cb59ee" title="get process id">getPid</a>();</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    <span class="keyword">static</span> uint32 <a class="code" href="classduye_1_1_system.html#a112533aa2a23327bd618f85ef344db13" title="get parent process id">getPPid</a>();</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classduye_1_1_system.html#a9f14e6cba9ea13261c1ce55a56810147" title="get system type and version">getSysInfo</a>(std::string&amp; name, std::string&amp; version);</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classduye_1_1_system.html#a851da139fe28a68d35ba3e9d86a3beaa" title="manual free system memory fragmentation">manMalloc</a>();</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;};</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Feb 27 2017 15:19:14 for Duye SDK User Wizard by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3
</small></address>
</body>
</html>
